﻿using System;
using System.ComponentModel;
using System.Linq;
using ProjectEuler.Extensions;
using ProjectEuler.Linq;

namespace ProjectEuler.Problems
{
    [EulerProblem(89, 743)]
    [Description("Develop a method to express Roman numerals in minimal form.")]
    internal sealed class Problem089 : EulerProblem
    {
        public override Object Solve()
        {
            var n = RomanNumeral.Parse("CLXXXXIX");

            using (var reader = OpenTextAttachment())
            {
                return (from line in reader.ReadAllLines()
                        let number = RomanNumeral.Parse(line)
                        let str = number.ToString()
                        select line.Length - str.Length).Sum();
            }
        }

       
    }
}
